Skip to content

Conversation

@zigzagdev
Copy link
Owner

Description

This PR addresses and corrects the routing paths used in two feature tests concerning the User API:

  • User_RegisterTest
  • User_ShowTest (assumed)

Both tests previously referred to incorrect endpoint patterns:

  • api/user/register → should be api/users/register
  • api/user/show/{id} → should be api/users/show/{id}

Copy link
Owner Author

@zigzagdev zigzagdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self Review

  • Replaced incorrect endpoint 'api/user/register' with 'api/users/register' in User_RegisterTest
  • Replaced incorrect endpoint 'api/user/show/{id}' with 'api/users/show/{id}' in User_ShowTest
  • Confirmed routes exist in API routing:
    Route::prefix('users')->group(function () {
        Route::post('register', ...);
        Route::get('show/{id}', ...);
    });
  • Executed both tests and confirmed successful response status codes (e.g., 201, 200)
  • Ensured that assertions and payload structures remained unchanged and valid
  • Verified that test logic is still aligned with real application behaviour

@zigzagdev zigzagdev requested a review from Copilot July 8, 2025 08:49
@zigzagdev zigzagdev self-assigned this Jul 8, 2025
@zigzagdev zigzagdev linked an issue Jul 8, 2025 that may be closed by this pull request
@zigzagdev zigzagdev removed a link to an issue Jul 8, 2025
@zigzagdev zigzagdev linked an issue Jul 8, 2025 that may be closed by this pull request
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes incorrect API endpoint paths in the User feature tests and improves test method naming.

  • Corrected api/user/... to api/users/... in both show and register tests
  • Renamed test methods to more descriptive names
  • Adjusted property declaration in User_ShowTest

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/app/User/Tests/User_ShowTest.php Removed User type-hint, renamed tests, fixed GET endpoint to api/users/show/{id}
src/app/User/Tests/User_RegisterTest.php Renamed tests and fixed POST endpoint to api/users/register
Comments suppressed due to low confidence (2)

src/app/User/Tests/User_ShowTest.php:55

  • [nitpick] The test name suggests this is a failure case, but it still asserts a 200 response. Consider renaming to reflect that it's a successful retrieval scenario.
    public function test_failed_with_invalid_property(): void

src/app/User/Tests/User_ShowTest.php:12

  • The property declaration has lost its User type-hint. Re-adding private User $user; will improve type safety and IDE support.
    private  $user;

@zigzagdev zigzagdev merged commit 7e4873d into main Jul 8, 2025
@zigzagdev zigzagdev deleted the feature/fix-user-api-tests branch July 8, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Fix User Feature Tests

1 participant